<?php
//sleep(5);
     
    include_once('connection/connection.php');
    if(isset($_REQUEST['name'])) {

		mysql_query("UPDATE tbl_lookup_zone  SET zone_name = '$_REQUEST[name]'  WHERE zone_id = '$_REQUEST[id]' ");
		mysql_query("UPDATE tbl_lookup_circle  SET zone_name = '$_REQUEST[name]'  WHERE zone_id = '$_REQUEST[id]' ");
		mysql_query("UPDATE tbl_lookup_division  SET zone_name = '$_REQUEST[name]'  WHERE zone_id = '$_REQUEST[id]' ");
		mysql_query("UPDATE tbl_lookup_sub_division  SET zone_name = '$_REQUEST[name]'  WHERE zone_id = '$_REQUEST[id]' ");
		
		echo "<td height='27' width='100' ></td>";
		echo "<td width='400' id='zone_id_". $_REQUEST['id'] ."'><font style='font-size: 8.5pt' face='Verdana' color='#000000'>".$_REQUEST['name']."</font></td>";
		echo "<td align='center'><a href='Javascript:void(0);' onClick=\" edit_zone('".$_REQUEST['id']."','".$_REQUEST['name']."'); \" ><font style='font-size: 8.5pt' face='Verdana' color='#000000'>Edit</font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
		echo "<span id='state_id_".$_REQUEST['id']."'>";
			$check_status = mysql_query("SELECT status FROM tbl_lookup_zone WHERE zone_id = '$_REQUEST[id]' ");
				$d = mysql_fetch_assoc($check_status);
				if($d['status'] == "1") echo "<a href='Javascript:void(0);' onClick=\"status_handler(0,'".$_REQUEST['id']."'); \" ><font style='font-size: 8.5pt' face='Verdana' color='#000000'>Disable</font></a>";
				else echo "<a href='Javascript:void(0);' onClick=\"status_handler(1,'".$_REQUEST['id']."'); \" ><font style='font-size: 8.5pt' face='Verdana' color='#000000'>Enable</font></a>";
		
		echo "</span></td>";
		echo "<td width='100' ></td>";
		unset($check_status);
		unset($d);
		
	}
	if(isset($_REQUEST['status'])) {
			if(mysql_query("UPDATE tbl_lookup_zone SET status = '$_REQUEST[status]' WHERE zone_id='$_REQUEST[id]' ")) {
					if($_REQUEST['status']==1) echo "<a href='Javascript:void(0);' onClick=\"status_handler(0,'".$_REQUEST['id']."'); \" ><font style='font-size: 8.5pt' face='Verdana' color='#000000'>Disable</font></a>";
					else echo "<a href='Javascript:void(0);' onClick=\"status_handler(1,'".$_REQUEST['id']."'); \" ><font style='font-size: 8.5pt' face='Verdana' color='#000000'>Enable</font></a>";
			}
			else{
			echo mysql_error();
			}
	}
	
	if(isset($_REQUEST['add_name'])) {
		if(mysql_query("INSERT INTO tbl_lookup_zone VALUE('','$_REQUEST[add_name]','1')")){
		echo "<tr onMouseOver=\" this.style.backgroundColor='#E5E5E5'; \" onMouseOut= \"this.style.backgroundColor='#FFFFFF'; \" id= 'row_id_".mysql_insert_id()."'><td height='27' width='100' class='zone_detail' ></td>";
		echo "<td width='400' id='zone_id_".mysql_insert_id()."' ><font style='font-size: 8.5pt' face='Verdana' color='#000000'>".$_REQUEST['add_name']."</font></td>";
		echo "<td align='center'><a href='Javascript:void(0);' onClick= \"edit_zone('".mysql_insert_id()."','".$_REQUEST['add_name']."'); \" ><font style='font-size: 8.5pt' face='Verdana' color='#000000'>Edit</font></a>&nbsp;&nbsp;&nbsp;&nbsp;";
		echo "<span id='state_id_".mysql_insert_id()."' ><a href='Javascript:void(0);' onClick= \" status_handler(0,'".mysql_insert_id()."'); \"  ><font style='font-size: 8.5pt' face='Verdana' color='#000000'>Disable</font></a></span>";
		}
	}
?>